package bBot;

import robocode.HitByBulletEvent;
import robocode.HitWallEvent;
import robocode.Robot;
import robocode.ScannedRobotEvent;
import static robocode.util.Utils.normalRelativeAngleDegrees;

public class Giskard extends Robot
{
	public void run()
	{
		while(true)
		{
			this.turnGunRight(360);
		}
	}

	public void onScannedRobot(ScannedRobotEvent e)
	{
		double absoluteBearing = getHeading() + e.getBearing();
		double bearingFromGun = normalRelativeAngleDegrees(absoluteBearing - getGunHeading());
		turnGunRight(bearingFromGun);

		double firepower = 1;//Math.min(3 - Math.abs(bearingFromGun), getEnergy() - .1);
		double bullettime = e.getDistance()/(20 - (3*firepower));

		this.out.println("E_Heading: " + e.getHeading());
		this.out.println("absoluteBearing: " + absoluteBearing);
		this.out.println("E_bearing: " + e.getBearing() +"\n");


		this.out.println("distance= " + e.getDistance());
		this.out.println("bulletTime= " + bullettime);
		this.out.println("d2= " + (bullettime*e.getVelocity()));
	}

	public void onHitByBullet(HitByBulletEvent e)
	{

	}

	public void onHitWall(HitWallEvent e)
	{

	}
}
